import React, { Component } from 'react'

export class tabtitle extends Component {

  render() {
    const {list,tab,active,add,del}=this.props
    
    return (
      <div> 
      <ul>
          {
              list.map((item,index)=>{
                  return <li key={item.id} onClick={
                      ()=>{
                          tab(item.id)
                      }
                  } className={ item.id===active ?'on' :'' }  >{item.title}
                  <span onClick={
                      ()=>{
                          del(item.id)
                      }
                  }>x</span>
                   </li>
              })
          }
          <span onClick={
                      ()=>{
                          add()
                      }
                  }>+</span>
         
         
      </ul>
      </div>
    )
  }
}

export default tabtitle